/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cong
 */
@Entity
@Table(name = "cuahang")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cuahang.findAll", query = "SELECT c FROM Cuahang c"),
    @NamedQuery(name = "Cuahang.findById", query = "SELECT c FROM Cuahang c WHERE c.id = :id"),
    @NamedQuery(name = "Cuahang.findByTencuahang", query = "SELECT c FROM Cuahang c WHERE c.tencuahang = :tencuahang"),
    @NamedQuery(name = "Cuahang.findByDiachi", query = "SELECT c FROM Cuahang c WHERE c.diachi = :diachi")})
public class Cuahang implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCuahang")
    private Collection<Nhanvien> nhanvienCollection;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "tencuahang")
    private String tencuahang;
    @Column(name = "diachi")
    private String diachi;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCuahang")
    private List<Doanhthu> doanhthuList;

    public Cuahang() {
    }

    public Cuahang(Long id) {
        this.id = id;
    }

    public Cuahang(Long id, String tencuahang) {
        this.id = id;
        this.tencuahang = tencuahang;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTencuahang() {
        return tencuahang;
    }

    public void setTencuahang(String tencuahang) {
        this.tencuahang = tencuahang;
    }

    public String getDiachi() {
        return diachi;
    }

    public void setDiachi(String diachi) {
        this.diachi = diachi;
    }

    @XmlTransient
    public List<Doanhthu> getDoanhthuList() {
        return doanhthuList;
    }

    public void setDoanhthuList(List<Doanhthu> doanhthuList) {
        this.doanhthuList = doanhthuList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cuahang)) {
            return false;
        }
        Cuahang other = (Cuahang) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gui.Cuahang[ id=" + id + " ]";
    }

    @XmlTransient
    public Collection<Nhanvien> getNhanvienCollection() {
        return nhanvienCollection;
    }

    public void setNhanvienCollection(Collection<Nhanvien> nhanvienCollection) {
        this.nhanvienCollection = nhanvienCollection;
    }
    
}
